﻿using System;
using System.Collections.Generic;
using System.Text;
using Common;
using System.Web;
namespace Configuration
{
    public sealed class UIConfig
    {
        #region app
        public static string WebDAL
        {
            get
            {
                if (CacheHelper.IsNull("WebDAL_app"))
                {
                    CacheHelper.SetCache(
                        "WebDAL_app",
                        ConfigBase.GetConfig("WebDAL"),
                        120);
                }
                return ConfigBase.GetConfig("WebDAL");
            }
        }
        public static string CrystalImageCleanerAutoStart
        {
            get
            {
                if (CacheHelper.IsNull("CrystalImageCleaner-AutoStart_app"))
                {
                    CacheHelper.SetCache(
                            "CrystalImageCleaner-AutoStart_app",
                            ConfigBase.GetConfig("CrystalImageCleaner-AutoStart"),
                            120);
                }
                return ConfigBase.GetConfig("CrystalImageCleaner-AutoStart");
            }
        }
        public static string CrystalImageCleanerSleep
        {
            get
            {
                if (CacheHelper.IsNull("CrystalImageCleaner-Sleep_app"))
                {
                    CacheHelper.SetCache(
                            "CrystalImageCleaner-Sleep_app",
                            ConfigBase.GetConfig("CrystalImageCleaner-Sleep"),
                            120);
                }
                return ConfigBase.GetConfig("CrystalImageCleaner-Sleep");
            }
        }
        public static string CrystalImageCleanerAge
        {
            get
            {
                if (CacheHelper.IsNull("CrystalImageCleaner-Age_app"))
                {
                    CacheHelper.SetCache(
                            "CrystalImageCleaner-Age_app",
                            ConfigBase.GetConfig("CrystalImageCleaner-Age"),
                            120);
                }
                return ConfigBase.GetConfig("CrystalImageCleaner-Age");
            }
        }
        public static string User
        {
            get
            {
                if (CacheHelper.IsNull("User_app"))
                {
                    CacheHelper.SetCache(
                            "User_app",
                            ConfigBase.GetConfig("User"),
                            120);
                }
                return ConfigBase.GetConfig("User");
            }
        }
        public static string Password
        {
            get
            {
                if (CacheHelper.IsNull("Password_app"))
                {
                    CacheHelper.SetCache(
                            "Password_app",
                            ConfigBase.GetConfig("Password"),
                            120);
                }
                return ConfigBase.GetConfig("Password");
            }
        }
        public static string Server
        {
            get
            {
                if (CacheHelper.IsNull("Server_app"))
                {
                    CacheHelper.SetCache(
                            "Server_app",
                            ConfigBase.GetConfig("Server"),
                            120);
                }
                return ConfigBase.GetConfig("Server");
            }
        }
        public static string DataBase
        {
            get
            {
                if (CacheHelper.IsNull("DataBase_app"))
                {
                    CacheHelper.SetCache(
                            "DataBase_app",
                            ConfigBase.GetConfig("DataBase"),
                            120);
                }
                return ConfigBase.GetConfig("DataBase");
            }
        }
        public string SqlTimeOutTime
        {
            get
            {
                if (CacheHelper.IsNull("SqlTimeOutTime_app"))
                {
                    CacheHelper.SetCache(
                            "SqlTimeOutTime_app",
                            ConfigBase.GetConfig("SqlTimeOutTime"),
                            120);
                }
                return ConfigBase.GetConfig("SqlTimeOutTime");
            }
        }
        /// <summary>
        /// 域名
        /// </summary>
        public static string WebUrl
        {
            get
            {
                if (CacheHelper.IsNull("WebUrl_app"))
                {
                    CacheHelper.SetCache(
                            "WebUrl_app",
                            ConfigBase.GetConfig("WebUrl"),
                            120);
                }
                return ConfigBase.GetConfig("WebUrl");
            }
        }
         /// <summary>
        /// 主题
        /// </summary>
        public static string Themes
        {
            get
            {
                if (CacheHelper.IsNull("Themes_app"))
                {
                    CacheHelper.SetCache(
                            "Themes_app",
                            ConfigBase.GetConfig("Themes"),
                            120);
                }
                return ConfigBase.GetConfig("Themes");
            }
        } 
        #endregion
        /// <summary>
        /// 错误定位
        /// </summary>
        /// <param name="Msg">错误信息</param>
        public static void ResponseErrorPage(string Msg)
        {
            StringBuilder sb = new StringBuilder();
            sb.Append("<html>");
            sb.Append("<head>");
            sb.Append("<title>错误信息</title>");
            sb.Append("<style type=\"text/css\">");
            sb.Append("body {");
            sb.Append("background-color: #ACB9D1;");
            sb.Append("}");
            sb.Append("</style>");
            sb.Append("</head>");
            sb.Append("<body>");
            sb.Append("<div id=\"error\">");
            sb.Append("<p align=\"center\">访问出错：" + Msg + "</p>");
            sb.Append("<hr style=\"height:1px;background-color:Black; border:1px;\"/>");
            sb.Append("<p align=\"center\">E_mail: vipdeli#hotmail.com</p>");
            sb.Append("<p align=\"center\">QQ: 549002835</p>");
            sb.Append("</div>");
            sb.Append("</body>");
            sb.Append("</html>");
            HttpContext.Current.Response.Write(sb.ToString());
            HttpContext.Current.Response.End();
        }


    }
}